package net.jescort.repository;

import net.jescort.domain.forum.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

public interface EscortRepository
{
    public Forum getForum(Integer forumId);
    public boolean forumExists(Integer forumId);
    
    public Topic getTopic(Integer topicId);
    public Topic getTopicWithBBCodeToHtml(Integer topicId);
    public void createTopic(Topic topic);
    public void editTopic(Topic topic);
    public Page<Topic> findTopicsByForum(Integer forumId, Pageable pageable);
    public Page<Topic> findTopicsByForumWithBBCodeToHtml(Integer forumId, Pageable pageable);
    public ModelAndView topicView(Integer id, Integer pageNo, Integer pageSize, ModelAndView mav);

    public void replyTopic(Post post, HttpServletRequest request);
    
    public Post getPost(Integer postId);
    public Post getPostWithBBCodeToHtml(Integer postId);
    public void createPost(Post post);
    public void editPost(Post post);
    public Post quotePost(Integer postId);
    public Page<Post> findPostsByTopicWithBBCodeToHtml(Integer topicId, Pageable pageable);

    public Message getMessage(Integer messageId);
    public Page<Message> findMessagesBySender(Integer senderId, Pageable pageable);
    public Page<Message> findMessagesByRecipient(Integer recipientId, Pageable pageable);

    public Attachment getAttachment(Integer attachmentId);
    public void saveAttachment(Attachment attachment);
}
